from socket import *
import pyaudio

p = pyaudio.PyAudio()
stream = p.open(format= pyaudio.paInt16, channels=2,rate=48000,output=True)

socket_server = socket(AF_INET, SOCK_DGRAM)
host_port = ('192.168.15.15', 5678)
socket_server.bind(host_port)

while True:
    data = socket_server.recvfrom(1024)
    stream.write(data[0])
#    bytes_data = data[0]
#    for i in range(0, len(bytes_data), 4):
#        stream.write(bytes_data[i:i+4]) # with format= pyaudio.paInt16

socket_server.close()

